    <form method=get>
    <input type="hidden" name="page" value="regions">
    <table>
      <tr>
<?php
    if ($session->logged_in) {
        $myRegions = $osInfo->getRegionList("",0,0,$session->uuid);
	if (!empty($myRegions) && !is_null($myRegions))
	    echo "<td><a href='" . $SYSURL . "index.php?page=regions&type=mine'>" . $session->lang['REGION_MY_REGIONS'] . "</a></td><td>|</td>";
    }
?>
	<td><a href='<?php echo $SYSURL; ?>index.php?page=regions&type=map'><?php echo $session->lang['LI_MAP']; ?></a></td><td>|</td>
	<td><?php echo $session->lang['GEN_SEARCH']; ?></td>
	<td><input type="text" id="regionSearch" name="search" autocomplete="off"></td><td><input type="submit" value="<?php echo $session->lang['GEN_SEARCH']; ?>"></td>
    </tr>
    </table>
    </form>
    <div class="autocomplete" id="regionList" style="display:none"></div>

    <script type="text/javascript">
    var regions = [<?php
      $regionList = $osInfo->getRegionList();

      foreach ($regionList as $reg) {
        echo "'" . $reg["regionName"] . "',";
      }

    ?>""];
    var typeahead = new Autocompleter.Local('regionSearch', 'regionList', regions, {
                            frequency: 0.1
                        });
    </script>
    <br><br>
    <?php 
      if (!is_null($_REQUEST['type']) && $_REQUEST['type'] == "map") {
	include("map.html");
      } else {
	if (!is_null($_REQUEST['search']) && $_REQUEST['search'] != "") 
	    echo $session->lang['GEN_SEARCH'] . ": " . $_REQUEST['search'] . " [<a href='?page=regions'>Clear</a>]"; 
	elseif (!is_null($_REQUEST['type']) && $_REQUEST['type'] == "mine")
	    echo $session->lang['GEN_SEARCH'] . ": " . $session->lang['REGION_MY_REGIONS'] . " [<a href='?page=regions'>Clear</a>]";
	else
	    echo $session->lang['LI_REGIONS'];
    ?><br><br>
    <table width=100% cellspacing=0 class='regionList'>
      <tr class='regionListTR'>
	<td class='regionListTD'><a href='#'><?php echo $session->lang['REGION_NAME']; ?></a></td>
	<td class='regionListTD'><a href='#'><?php echo $session->lang['REGION_LOCATION']; ?></a></td>
	<td class='regionListTD'><a href='#'><?php echo $session->lang['REGION_OWNER']; ?></a></td>
	<td class='regionListTD' width=50 align=center><a href='#'><?php echo $session->lang['REGION_STATUS']; ?></a></td>
      </tr>
    <?php
      $rC = 0;
      if (!is_null($_REQUEST['type']) && $_REQUEST['type'] == "mine")
	$regions = $myRegions;
      else
        $regions = $osInfo->getRegionList($_REQUEST['search']);

      if (!is_null($regions)) {
        foreach ($regions as $reg) {
  	  if ($rc++%2==0) 
	    $style=" style='background: #333333;'";
	  else 
	    $style=" style='background: #000000;'";

	  $div =  $reg["locX"] . "." . $reg["locY"];
	  echo "\t<tr$style onMouseOver='showPic(event,\"$div\")' onMouseOut='hidePic(\"$div\");'><td>";
	  echo "<div id='$div' style='position: absolute; display: none;'><div class='regPicName'>" . $reg["regionName"] . "</div><img src='" . $SYSURL . "includes/map.php?x=" . $reg["locX"] . "&y=" . $reg["locY"] . "')' height=128></div>";
	  echo $reg["regionName"] . "</td><td>" . $reg["locX"] . "," . $reg["locY"] . "</td><td>" . $reg["username"] . " " . $reg["lastname"] . "</td><td align=center><img src='";
	  if ($osInfo->checkSimulator($reg["serverIP"], $reg["serverHttpPort"])) 
	      echo $TEMPLATE_PATH . "images/online.png' alt='online'></td></tr>\n";
	  else
	      echo $TEMPLATE_PATH . "images/offline.png' alt='offline'></td></tr>\n";
	}
      } else {
	echo "<tr><td colspan=4>" . $session->lang['REGION_NO_RESULTS'] . "</td></tr>";
      }
    ?>
    </table>
  <?php } ?>
